/**
 * 
 */
package com.googlecode.iant.task2xsd;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.War;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.ReflectionUtils.MethodCallback;
import org.springframework.util.ReflectionUtils.MethodFilter;

/**
 * @author ccPascu
 *
 */
public class AntTask2Schema {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Class<? extends Task> taskClass = War.class;
		ReflectionUtils.doWithMethods(taskClass, new MethodCallback(){

			@Override
			public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
				System.out.println("Found method: " + method.getName());
			}
			
		}, new MethodFilter() {

			@Override
			public boolean matches(Method method) {
				if (!Modifier.isPublic(method.getModifiers()) ) {
					return false;
				}
				final String name = method.getName();
				return name.startsWith("add") || name.startsWith("set") || name.startsWith("create");
			}
			
		});
	}

}
